package com.liang.cloud.Util;


import com.liang.cloud.Emun.CodeEnum;

/**
 * @author: 余亮亮
 * @description:
 * @create: 2020-01-05 16:08:28
 **/
public class EnumUtil {

    public static <T extends CodeEnum> T getByCode(Integer code, Class<T> enumClass){
        for (T each:enumClass.getEnumConstants()){
           if(each.getCode().equals(code)){
               return each;
           }
        }
        return null;
    }
}
